home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d19
/
gw15pak.arc
/
POSITIVE.ARC
/
POSITIVE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-12-18
|
1KB
|
51 lines
PROGRAM Positive;
{delete all zero and negative scores from winners.war}
TYPE
RecPtr = ^WinnerRec;
WinnerRec = RECORD
Wins : LONGINT;
Name : STRING[17];
next : RecPtr;
END;
VAR
f : TEXT;
o,p,start,last : RecPtr;
nam : STRING[17];
w : LONGINT;
BEGIN
start := NIL;
last := NIL;
w := IOresult;
ASSIGN(f,'WINNERS.WAR');
{$I-} RESET(f); {$I+}
IF IORESULT=0 THEN BEGIN
WHILE NOT EOF(f) DO BEGIN
READLN(f, w);
READLN(f, nam);
IF w>0 THEN BEGIN
NEW(p);
IF last=NIL THEN
start:= p
ELSE
last^.next := p;
p^.next := NIL;
last := p;
p^.Wins := w;
p^.Name := nam;
END;
END;
CLOSE(f);
ASSIGN(f,'WINNERS.WAR');
REWRITE(f);
p := start;
WHILE (p<>NIL) DO BEGIN
WRITELN(f,p^.Wins);
WRITELN(f,p^.Name);
o := p;
p := p^.next;
DISPOSE(o);
END;
CLOSE(f);
END;
END.